#ifndef SETTINGS_H
#define SETTINGS_H

#include <QObject>
#include <QFile>
#include <QStringList>
#include <QTimer>
#include <QDebug>
#include <windows.h>
#include "currentstatus.h"

#include "pelicanows.h"

class SettingsThread;
class Settings : public QObject
{
    Q_OBJECT
public:
    ~Settings();
    static Settings* getInstance();
    bool refresh();

    void setDriveLetter(QString);
    void setTemporalPath(QString);
    void setFinalPath(QString);
    void setServerIP(QString);
    void setServerPort(int);
    void setServerPath(QString);
    void setMymoviesUsername(QString);
    void setMymoviesPassword(QString);
    void setTimeFromReboot(QTime);
    void setTimeToReboot(QTime);
    void setIdDevice(QString);

    QString getDriveLetter();
    QString getTemporalPath();
    QString getFinalPath();
    QString getServerIP();
    int getServerPort();
    QString getServerPath();
    QString getMymoviesUsername();
    QString getMymoviesPassword();
    QTime getTimeFromReboot();
    QTime getTimeToReboot();
    QString getIdDevice();

signals:
    void changedDriveLetter(QString);
    void changedFinalPath(QString);
    void changedTempPath(QString);
    void changedMyMoviePassword(QString);
    void changedMyMovieUsername(QString);
    void changedTimeFromReboot(QTime);
    void changedTimeToReboot(QTime);
    void changedIdDevice(QString);
public slots:

private:
    explicit Settings(QObject *parent = 0);
    bool refreshFromWS();
    bool refreshFromCFGFile();

    static Settings* _instance;
    bool _working;
    //from WS
    QString _driveLetter;
    QString _temporalPath;
    QString _finalPath;
    QString _mymoviesUsername;
    QString _mymoviesPassword;
    QTime _timeFromReboot;
    QTime _timeToReboot;
    QString _idDevice;
    //from file
    QString _serverIP;
    int _serverPort;
    QString _serverPath;

    QTimer *_timer;

    SettingsThread *_settingsThread;

    bool valid;

};

#endif // SETTINGS_H
